import os
import copy

BIN_DIR=os.environ['BIN_DIR'];
LIB_DIR=os.environ['LIB_DIR'];
NANOVG_BACKEND=os.environ['NANOVG_BACKEND'];

sources=Glob('tkc/*.c') +\
  Glob('base/*.c') + \
  Glob('layouters/*.c') + \
  Glob('widgets/*.c') + \
  Glob('ui_loader/*.c') + \
  Glob('xml/*.c') + \
  Glob('svg/*.c') + \
  Glob('clip_board/*.c') + \
  Glob('font_loader/*.c') + \
  Glob('blend/*.c') + \
  Glob('ext_widgets/*.c') + \
  Glob('ext_widgets/*/*.c') + \
  Glob('image_loader/*.c') + \
  Glob('designer_support/*.c') + \
  Glob('widget_animators/*.c') + \
  Glob('platforms/pc/*.c') + \
  Glob('misc/*.cpp') + \
  ['awtk_global.c'];

sources += ['main_loop/main_loop_simple.c'];
if os.environ['LCD'] == 'SDL_GPU':
  sources += ['window_animators/window_animator_gpu.c'];
  sources += ['lcd/lcd_nanovg.c', 'main_loop/main_loop_sdl_gpu.c'];
elif os.environ['LCD'] == 'SDL_FB':
  sources += ['window_animators/window_animator_fb.c'];
  sources += ['lcd/lcd_sdl2.c', 'main_loop/main_loop_sdl_fb.c']
else:
  sources += ['window_animators/window_animator_fb.c'];

sources += [
  'input_methods/input_method_creator.c'
  ] + Glob('lcd/lcd_mem_*.c') ;

if NANOVG_BACKEND == 'BGFX':
  sources +=['vgcanvas/vgcanvas_nanovg_bgfx.c'];
elif NANOVG_BACKEND == 'AGG':
  sources +=['vgcanvas/vgcanvas_nanovg_soft.c'];
elif NANOVG_BACKEND == 'AGGE':
  sources +=['vgcanvas/vgcanvas_nanovg_soft.c'];
else:
  sources +=['vgcanvas/vgcanvas_nanovg_gl.c'];

if os.environ['INPUT_ENGINE'] == 'null':
  sources += Glob('input_engines/input_engine_null.c')
else:
  sources += Glob('input_engines/input_engine_pinyin.cpp')

env=DefaultEnvironment().Clone()
env.Library(os.path.join(LIB_DIR, 'awtk'), sources)
